import { del, get, post, put } from '@/utils/request';

interface Brand {
  id: number
  nameZh: string
  nameEn: string
  descriptionZh: string
  descriptionEn: string
  img: string
  createdAt: string
  updateAt: string
}
interface Brands {
  data: Brand[]
  total: number
  page: number
  limit: number
}
export const getBrands = (params: any) => {
  return get<Brands>('/admin/brands', params);
};

export const changeBrands = (data: any) => {
  if(data.id) {
    return put(`/admin/brands/${data.id}`, data);
  } else {
    return post('/admin/brands', data);
  }
};

export const deleteBrands = (id: string) => {
  return del(`/admin/brands/${id}`);
};
